layui.define(['table', 'form', 'laytpl'], function (exports) {
    var $ = layui.$,
        table = layui.table,
        form = layui.form,
        laytpl = layui.laytpl;

    //监听新增
    form.on('submit(LAY-userCenter-front-add)', function (data) {
        let field = data.field;
        $.ajax({
            url: '/userCenter/update', method: 'post', data: field, success: (result) => {
                if (result == 1) {
                    layer.msg('修改成功！');
                    //延迟1秒
                    setTimeout(function () {
                        window.location.reload();//刷新当前页面.
                    }, 1000);
                } else if (result == 2) {
                    layer.msg('修改失败，手机号或者其他的资料重复，无法修改！');
                } else {
                    layer.msg('修改失败！');
                }


            }
        });
    });
    exports('userCenter', {});

});



